<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>axios的基本使用</title>
</head>
<body>
<input type="button" value="get请求" class="get"></input>
<input type="button" value="post请求" class="post"></input>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<div id="app">

</div>

<script>
document.querySelector(".get").onclick = function () {
    axios.get("https://autumnfish.cn/api/joke/list1234?num=6")
    .then(function (response) {
        console.log(response);
    },
        function (err) {
        console.log(err);

        }
    )
}

document.querySelector(".post").onclick = function () {
    axios.post("https://autumnfish.cn/api/user/reg",
        {username:"JohnWick"})
        .then(function (response) {
            console.log(response)

        })
        .then(function (response) {
                console.log(response);
            },
            function (err) {
                console.log(err);

            }
        )
}

</script>
</body>
</html>
